package com.yzkj.siot.controller;

import com.yzkj.siot.annotation.Permission;
import com.yzkj.siot.annotation.WebLog;
import com.yzkj.siot.base.BaseController;
import com.yzkj.siot.domain.AdminTenant;
import com.yzkj.siot.domain.SysDict;
import com.yzkj.siot.facade.SysDictFacade;
import com.yzkj.siot.facade.TenantFacade;
import com.yzkj.siot.result.PageParams;
import com.yzkj.siot.result.PageResponse;
import com.yzkj.siot.type.ApiType;
import com.yzkj.siot.type.PermissionType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sysDict")
public class SysDictController extends BaseController {

    @Autowired
    SysDictFacade facade;

    @WebLog(type = ApiType.READ)
    @Permission(type = PermissionType.ANY)
    @PostMapping("page")
    public PageResponse<SysDict> page(@RequestBody PageParams<SysDict> pageParams) {
        return this.facade.page(pageParams);
    }

    @WebLog(type = ApiType.READ)
    @Permission(type = PermissionType.ANY)
    @GetMapping("/queryOne")
    public SysDict queryOne(Integer id) {
        return this.facade.queryOne(id);
    }

    @WebLog(type = ApiType.SAVE_OR_UPDATE)
    @Permission(type = PermissionType.ADMIN)
    @PostMapping("/saveOrUpdate")
    public SysDict saveOrUpdate(@RequestBody SysDict entity) {
        return this.facade.saveOrUpdate(entity);
    }
}
